UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gmXhWqb9FJN1v7CmaX7T3otbZC830+s9h9mrlHnWr3Q='
WHERE
key_id = 'ca7f09464ac3427353d757d46fc9dc85dd698f4d00c9771e1c5a20a1062d4ef8'
AND (
token = 'gmXhWqb9FJN1v7CmaX7T3otbZC830+s9h9mrlHnWr3Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)