UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BKb1tI07M/Qj3Jd5riHo4Jal+flarnqyVjsUZPQtjt4='
WHERE
key_id = '4a2ea2c0e92d79c10e661329581df2052654e93c176a4bd97494b16d786bf3c6'
AND (
token = 'BKb1tI07M/Qj3Jd5riHo4Jal+flarnqyVjsUZPQtjt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)