UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M6ZdvnG/kFu8zV/WRnUsyfsg2xMjfl3QjK9qIrft7vE=' 
WHERE 
  key_id = '782e9ba007d5914031ef5f6808339c3aefbc9e7bbd51796b0aa605299d6ce971' 
  AND (
    token = 'M6ZdvnG/kFu8zV/WRnUsyfsg2xMjfl3QjK9qIrft7vE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052