UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f9adwjHd4/fVVJAiu4oufUOoEZTX6z7aPykB6iDNk9k='
WHERE
key_id = 'f6857840967c395f42e67f78ba8da4dd40ca87a873f89abdf1974477251b0e9d'
AND (
token = 'f9adwjHd4/fVVJAiu4oufUOoEZTX6z7aPykB6iDNk9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)