UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Tya2RKaZIpgl5svL5FiLihNcWvTx6eDFchhNI6CYzE='
WHERE
key_id = '538bf2f261c6064de3b27dbbab4eed81885a6977da982f60ed1ef1777677e8a0'
AND (
token = '8Tya2RKaZIpgl5svL5FiLihNcWvTx6eDFchhNI6CYzE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)