UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J+Y1gkbWvQbQcTpDKXpMvepmIo60zw5h4Xi0KuSSpw8='
WHERE
key_id = '0ab38f5b86d6880c2819404a2417078351c8a5cd61099baffd8ad4c2ca3dd14d'
AND (
token = 'J+Y1gkbWvQbQcTpDKXpMvepmIo60zw5h4Xi0KuSSpw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)