UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ljqi/Jq2ZxT8euVxvs/FdHzuRrFpkGvBJVulEG2Yc9o='
WHERE
key_id = 'ef3406a3785b0a8db13e636de6b035b1caf8acafa360e7f8d484457dc7086a3a'
AND (
token = 'ljqi/Jq2ZxT8euVxvs/FdHzuRrFpkGvBJVulEG2Yc9o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)