UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2g2oTWYPzlkwVC1tXjckRcJhkLL8sApvDR6sNgMKmdw='
WHERE
key_id = '2ce2e77fbc80d7de7fd6a082b5fc058c92bcc17364e36abdff3b3fafd92bfc5a'
AND (
token = '2g2oTWYPzlkwVC1tXjckRcJhkLL8sApvDR6sNgMKmdw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)