UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dg5guOS0BN3Op/96z7Lz2OnrV8CHAcT+PmoTIpjAmck='
WHERE
key_id = '3fd72f8bbdcc27baf8e61930b2bd10b198680fbf9c4ce660918434a36e35a72b'
AND (
token = 'dg5guOS0BN3Op/96z7Lz2OnrV8CHAcT+PmoTIpjAmck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)