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