UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ry/t+c0JyeKTsTwMkuCZN41pD/BKgwO5vSmEZXwlcwo='
WHERE
key_id = '27b962ff74634205af0aa0a72a126f98a5b0fb6c683da6551153639a3ca3d9c9'
AND (
token = 'Ry/t+c0JyeKTsTwMkuCZN41pD/BKgwO5vSmEZXwlcwo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)