UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'heY5ThW0N7CbSMOHwGvnwmuO6wRo58oUy4CA+ENTbRQ='
WHERE
key_id = 'ff9ccd03ec202be29141f4b55157cac75817e65f1e4c53790286816bc8221f98'
AND (
token = 'heY5ThW0N7CbSMOHwGvnwmuO6wRo58oUy4CA+ENTbRQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)