UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4CK7lBsz5lbYfy2f5dJxU6nIxLvkM9k87sF3OqmnpZM='
WHERE
key_id = 'ef50748df31e48a47cae26b0bbdcf17a4de7c9f0badd5f88595b83a656bc975e'
AND (
token = '4CK7lBsz5lbYfy2f5dJxU6nIxLvkM9k87sF3OqmnpZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)