UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JozIh/6oc8hkwb6aiDhIWl1ywSkGTszi7twf7n8pCVM='
WHERE
key_id = 'd57b7538b1ee05c03387acbd3a824b83771a41bb49792eeb0b95b76d48ba6b31'
AND (
token = 'JozIh/6oc8hkwb6aiDhIWl1ywSkGTszi7twf7n8pCVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)