UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uNn8+/unF4QZNOgQViT/9YxoE8/NaLrart6S/TylxxQ=' 
WHERE 
  key_id = 'dd643a6ee582928f224676d183a3c50396266b7beb6368de2d315e9a3a4bf5dc' 
  AND (
    token = 'uNn8+/unF4QZNOgQViT/9YxoE8/NaLrart6S/TylxxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029