UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mzQc62XDYq3KU+0y+F82xhSXQXANonANoNlCqLjF0gg=' 
WHERE 
  key_id = 'f1b36da089ba418950e2660b3ca08aa8035906f653a0fcc2f7e68542d62c16a4' 
  AND (
    token = 'mzQc62XDYq3KU+0y+F82xhSXQXANonANoNlCqLjF0gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039