UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tJqsgIRVy+AaFmWg2rs4E4u7idXfuYUsqkM59USAhO4='
WHERE
key_id = '3f8ba10100ac73fb3bcf2ea06c99b0b5f81fa69203935f436a35540f0bf01233'
AND (
token = 'tJqsgIRVy+AaFmWg2rs4E4u7idXfuYUsqkM59USAhO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)