UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7w7WuKz8uMLW6WjY8SnZ8yoDvGAxsRCxkqJA9PtrZhc='
WHERE
key_id = '97d6b70527b11ed6d2a044027b0f935c13b5069f4446e16889be4b47fee254d7'
AND (
token = '7w7WuKz8uMLW6WjY8SnZ8yoDvGAxsRCxkqJA9PtrZhc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)