UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R8za4sgIELsZ8+qqHHauI0T8JObdea51IGVZkLoFSU0='
WHERE
key_id = 'a21f9ee35b7de7d5ac77ee0a6e833823c49cb0f3c4f7a8fd2701c24106098375'
AND (
token = 'R8za4sgIELsZ8+qqHHauI0T8JObdea51IGVZkLoFSU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)