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