UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mhOcjdraMfFr0Mz3muwJSqXW5XpLTb1zCESgneQEdUw='
WHERE
key_id = '89675e69e4d0c3f7d4d8bb439fce5ebf7db94ccc8df1cbb1e884b98ac3ca9395'
AND (
token = 'mhOcjdraMfFr0Mz3muwJSqXW5XpLTb1zCESgneQEdUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)