UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PSm22dLM0yDK7/hEDJIU0bG/q4ronvUCouCkvQgW1dw='
WHERE
key_id = '5af11b995a79f6971941e92fc865d13db1f0932a358f460b3ae881eb54a3200c'
AND (
token = 'PSm22dLM0yDK7/hEDJIU0bG/q4ronvUCouCkvQgW1dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)