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

Query time 0.00041