UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1L73yKS1NJ5F5FFeTdqI+KsWkbiB14hqelO49X42qoE=' 
WHERE 
  key_id = '57aaec25a74606e5f536f6913acd08496d5ad259e4456056f43f8a0b0f213746' 
  AND (
    token = '1L73yKS1NJ5F5FFeTdqI+KsWkbiB14hqelO49X42qoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039