UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Z+SwVtvEERaOGToG6Qc8Ay7uDRy/val+mo42VSOkYg='
WHERE
key_id = 'af56de39732aa95d8bc955e2cc2f21fbde8b49c090bb1075a09117de40599ecd'
AND (
token = '6Z+SwVtvEERaOGToG6Qc8Ay7uDRy/val+mo42VSOkYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)