UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YRkeeSt43b91qo7IszIQBaqXfqsRWwro4DdXW1H8tYo='
WHERE
key_id = 'ca992b9d698afbe760c96225208da4bccd80bf47e80107b4be05ccda31a83b2d'
AND (
token = 'YRkeeSt43b91qo7IszIQBaqXfqsRWwro4DdXW1H8tYo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)