UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZgqkEXqftDQEi+5RE20ETMjHBJIa7ngzZEPRuAIpaAs='
WHERE
key_id = 'ea1eebb9295a5e9aabb38d8522cba2fb2156e53772e2d0db2ac9a3503308447d'
AND (
token = 'ZgqkEXqftDQEi+5RE20ETMjHBJIa7ngzZEPRuAIpaAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)