UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FgtS8IoqsqtZsYoKvzqixnIiaRy2x7wDJpWOukquAL4=' 
WHERE 
  key_id = '1f4fe1ee0348769215e3fea8134b4ddc8350a4a12c75ba4c318f7a29384de514' 
  AND (
    token = 'FgtS8IoqsqtZsYoKvzqixnIiaRy2x7wDJpWOukquAL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019