UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YOoIyFB9BT3C3Z1quzfT30oVsyiFjmGbHZrXs2aL0jE='
WHERE
key_id = '52b9789e425df6b68e69cb9639baa2f88b83adf5a67aee80afa16623f969ef45'
AND (
token = 'YOoIyFB9BT3C3Z1quzfT30oVsyiFjmGbHZrXs2aL0jE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)