UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k+jb0HXNPMNKD2mgm3rFNIFuhZSzT1Ex7QTkC56pups='
WHERE
key_id = 'a1be3b15cc188ec7c7dba254bd368fe167acbac64d38a5d36b9dd441890139ca'
AND (
token = 'k+jb0HXNPMNKD2mgm3rFNIFuhZSzT1Ex7QTkC56pups='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)