UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UobTs29Z0qfERbpota3nrloTHhiwCFmNqmr2JrHTVy4=' 
WHERE 
  key_id = 'b874d4ebda1ac5259055a1e0dc620c3ac6e330798267c400d3a325617636c439' 
  AND (
    token = 'UobTs29Z0qfERbpota3nrloTHhiwCFmNqmr2JrHTVy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027