UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'knU0OXBXlmDpo6LpEdqASi/fp5jVAlVrHBCUr3YE4K4=' 
WHERE 
  key_id = 'bf7651a03257a1afd8f9548200fc857d8731a4561ad92c66c60a029ee8525f58' 
  AND (
    token = 'knU0OXBXlmDpo6LpEdqASi/fp5jVAlVrHBCUr3YE4K4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036