UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GfHMUmKcK/BBpZo31V5vXjPlKZnBLDHMj+sjama2Afk='
WHERE
key_id = '39f5485db3183f65b3be9f6c50537403ecf32a243e19ed1c47dd4a40aad709da'
AND (
token = 'GfHMUmKcK/BBpZo31V5vXjPlKZnBLDHMj+sjama2Afk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)