UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fJw8mADBkUSknCrEcAlBVBX0HUR63QMnOv7SU+Y6+Rg='
WHERE
key_id = '6d5e04e0772c42e2d9344a4f9a80ba203af0d32625548862298a20c32cceee2a'
AND (
token = 'fJw8mADBkUSknCrEcAlBVBX0HUR63QMnOv7SU+Y6+Rg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)